﻿using System;
using System.Web;
using System.Web.Routing;
using System.Web.Mvc;

namespace TidyBlog.MVC
{
    /// <summary>
    /// 异常过滤器（使用统一的提示页面显示）
    /// </summary>
    public class ErrorFilter : FilterAttribute, IExceptionFilter
    {
        public void OnException(ExceptionContext filterContext)
        {
            if (filterContext.Exception != null)
            {
                filterContext.ExceptionHandled = true;

                RespondentInfo.Error(filterContext, new OperInfo()
                {
                    Message = filterContext.Exception.Message
                });
            }
        }
    }
}